package com.hwadee.teachingprocessmanagementsystem.service.base.impl;

import com.hwadee.teachingprocessmanagementsystem.entity.ClassroomRequest;
import com.hwadee.teachingprocessmanagementsystem.dao.ClassroomRequestDao;
import com.hwadee.teachingprocessmanagementsystem.service.base.ClassroomRequestService;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;

import java.util.List;

/**
 * 教室申请表(ClassroomRequest)表服务实现类
 *
 * @author makejava
 * @since 2024-07-11 14:20:02
 */
@Service("classroomRequestService")
public class ClassroomRequestServiceImpl implements ClassroomRequestService {
    @Resource
    private ClassroomRequestDao classroomRequestDao;

    /**
     * 通过ID查询单条数据
     *
     * @param requestId 主键
     * @return 实例对象
     */
    @Override
    public ClassroomRequest queryById(Integer requestId) {
        return this.classroomRequestDao.queryById(requestId);
    }


    /**
     * 新增数据
     *
     * @param classroomRequest 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(ClassroomRequest classroomRequest) {
        return this.classroomRequestDao.insert(classroomRequest);
    }

    /**
     * 修改数据
     *
     * @param classroomRequest 实例对象
     * @return 实例对象
     */
    @Override
    public ClassroomRequest update(ClassroomRequest classroomRequest) {
        this.classroomRequestDao.update(classroomRequest);
        return this.queryById(classroomRequest.getRequestId());
    }

    /**
     * 通过主键删除数据
     *
     * @param requestId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer requestId) {
        return this.classroomRequestDao.deleteById(requestId) > 0;
    }

    @Override
    public List<ClassroomRequest> queryAllByLimit(ClassroomRequest classroomRequest) {
        return this.classroomRequestDao.queryAllByLimit(classroomRequest);
    }
}
